<?php

	header("Content-Type: text/html;charset=utf-8"); 

	include("../function/_nosql.php");

	include("../function/function.php");
	
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>注册_<?php echo $web_titles; ?></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="Keywords" content="<?= $web_keywords ?>" />
		<meta name="Description" content="<?= $web_description ?>" />
		<link rel="stylesheet" type="text/css" href="css/index.css"/>
		<link rel="stylesheet" type="text/css" href="./css/xiangqing.css"/>
		<script type="text/javascript" src="../js/baidutongji.js"></script>
		<script src="./js/jquery-1.10.2.min.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			@media screen and (max-width:320px ) {
				.login-bd .login_chest1{
					width: 80px !important;
				}
			}
		</style>
	</head>
	<body style="background:#BAD3F0;">
			<div class="login-box">
				<div class="quxiao" onclick="history.go(-1)" ><a href="javascript:;"></a><</div> 
			<div class="title">欢迎注册中国徒步网</div>
				<form name="regform" id="regform" method="post" action="../regsave.php?action=savephone">
				<input type="hidden" name="redirect_urls" id="redirect_urls" value="<?=$redirect_urls?>" />
				<input type="hidden" name="newsid" id="newsid" value="<?=$newsid?>" />
				<input type="hidden" name="URL" id="URL" value="<?=$URL?>" />
                <div class="login-bd pt24">
                    <div class="f-login-wrap">
                        <div class="f-login-pane current">
		                    <div class="f-login">
		                        <input name="user_phone" id="user_phone" type="text" placeholder="请输入手机号" class="login-input login_mess1" value="">
		                    </div>
		                    <p class="phone_text"></p>
		                    <div class="f-login">
		                        <input name="user_phonecode" type="text" class="login-input login_chest1" id="user_phonecode" value="" placeholder="验证码">
		                        <span class="get-yzm">
		                        	<a href="javascript:;" class="noyzm" >获取验证码</a>
		                        	<a href="javascript:;" class="yesyzm" ><span>60</span>s后再获取</a>
								</span>
		                    </div>
		                    <p></p>
		                    <div class="f-login">
		                        <input name="user_nickname" id="user_nickname" type="text" placeholder="昵称" class="login-input login_name" value="">
		                    </div>
		                     <p></p>
		                    <div class="f-login">
		                        <input name="user_password" id="user_password" type="password" placeholder="密码" class="login-input login_password" value="">
		                    </div>
		                    <p class="password_text"></p>
		                    <div class="f-login">
		                        <input name="user_repassword" id="user_repassword" type="password" placeholder="重复密码" class="login-input login_password" value="">
		                    </div>
		                    <div class="login-btn">
									<input type="submit" name="reg_btn" class="basic-btn" value="立即注册" />
								<br />
							</div>                           
                        </div>
                        
                    </div>
                </div>
				</form>
            </div>

			
	</body>
	</html>
	<script type="text/javascript" src="../js/alert.js"></script>
	<script type="text/javascript" src="../layer/layer.js"></script>

	<script>
    $(document).ready(function() {
        $(".gengduo .xiany a").click(function(){
        	var a = $(this).offset().top;
            $(this).addClass("on").closest(".xiany").siblings(".xiany").find(".xing").slideUp("xiany").siblings("a").removeClass("on");
            $(this).removeClass("on").next(".xing").slideToggle("xiany");
            $('body,html').animate({'scrollTop':a},500)
        });

    });
</script>
<script type="text/javascript">
// 用户名验证
		$("#user_phone").blur(function(){
			$.ajax({ 
				url:'../regsave.php', 
				type:'post',
				dataType:'html',
				data:'action=chkuserphone&user_phone=' + $("#user_phone").val() + '&date='+new Date(),
				error: function(){
					layer.msg('Error loading document'); 
				},success: function(msg){
					if(msg == 1){
						$(".phone_text").html("");
					}else{
						$(".phone_text").html(msg);
					}
				} 
			}); 
		});
		$(".noyzm").click(function(){
			var phone = $("input[name=user_phone]").val();
			if(phone.replace(/\ /g,"").length<1){
				alert("手机不能为空！");
				return false;
			}
			$.ajax({
				type:"post",
				url:"/duanxin/fileTest.php",
				data:{phone:phone},
				dataType:"json",
				success:function(data){
					if(data == 1){
						var str = '<div class="award-box"><div class="award-hd"><div class="award-tips"><img src="../images/confirm.png" alt=""/></div><div class="award-notice">验证码我们已经通过短信形式发送到</br>您的手机号'+phone+'，请注意查收！</div><span class="rect"></span></div><span class="layui-layer-setwin"><a class="layui-layer-ico layui-layer-close layui-layer-close2" href="javascript:;"></a></span></div>';
						$("body").append(str);
						$(".layui-layer-close").on("click",function(){
							$(".award-box").remove();
						})
					}else if(data == 3){
						alert("手机不能为空");
					}else if(data == 2){
						alert("系统忙请重新发送");
					}
				}
			});
			$(this).hide();
			$(".yesyzm").show().css({"background":"#919191","cursor":"not-allowed"});
			t = setInterval(function(){
				var yes = $(".yesyzm span").html();
				var newyes = yes - 1 ;
				$(".yesyzm span").html(newyes);
				if(newyes == 0){
						clearInterval(t);
						$(".yesyzm span").html(60);
						$(".noyzm").show();
						$(".yesyzm").hide();
				}
			},1000)
		})
	</script>
<script type="text/javascript">
	$("#regform").submit(function(){
			var user_phone = $("#user_phone").val();
			var user_phone_rule = /^1[134578]\d{9}$/;
			var user_phonecode = $("#user_phonecode").val();
			// 手机号验证
			if(!user_phone_rule.test(user_phone)){
				alert("手机号格式错误！！");
				$("#user_phone").focus();
				return false;
			}
			// 验证码验证
			if (user_phonecode.replace(/\ /g,"").length<1){
				alert("请正确输入验证码！");
				$("#user_phonecode").focus();
				return false;
			}
		})

	$("input[name=user_phonecode]").blur(function(){
			
			var yzm = $(this).val()+','+$("input[name=user_phone]").val();
			$.ajax({
				type:"post",
				url:"../alert.yuphone.php?yzm=val",
				data:{yzm:yzm},
				dataType:"json",
				success:function(data){
					if(data == 8){
						alert("验证码已失效");
					}
					if(data == 7){
						alert("手机失效，重新输入");
					}
					if(data !=1 ){
						$("input[name=user_realname]").val(data[0]);
						$("input[name=user_idcard]").val(data[1]);
						$("input[name=user_nickname]").val(data[2]);
					}else{
						$("input[name=user_realname]").val('');
						$("input[name=user_idcard]").val('');
						$("input[name=user_nickname]").val('');
						alert('验证码错误')
					}
					
				}
			});
		})
</script>
